package com.wu.family.more;

import java.net.URL;
import java.util.Random;

import javax.activation.MailcapCommandMap;

import org.json.JSONObject;


import com.mobclick.android.MobclickAgent;
import com.wu.family.R;
import com.wu.family.config.UserInfo;
import com.wu.family.feed.FeedListAdapter;
import com.wu.family.guid.GuidActivity;
import com.wu.family.utils.LoadImgTask;
import com.wu.family.utils.ze.LoadAvatarBmpMgr;
import com.wu.family.views.MyListView;

import android.R.string;
import android.app.Activity;
import android.app.ActivityGroup;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.RelativeLayout.LayoutParams;

public class MoreThemeActivity extends Activity implements OnClickListener{

	private LinearLayout llLlTitle;
	private ImageView ivIvAvatar;
	private LinearLayout llLlUserInfo;
	private TextView tvTvUserName;
	private TextView tvTvNickName;
	
	private TextView tvTvFamilyNum;
	private TextView tvTitle;
	private ListView lvListView;
	private LinearLayout llLlBottom;
	private ImageButton ibBtnBack;
	
	private MoreThemeAdapter mAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MobclickAgent.onError(this);
        MobclickAgent.update(this); 
        MobclickAgent.setUpdateOnlyWifi(false);
        setContentView(R.layout.more_theme);
        
        initView();
        initEvent();
	}

	private void initView() {
		llLlTitle = (LinearLayout) findViewById( R.id.llTitle );
		ivIvAvatar = (ImageView) findViewById( R.id.ivAvatar );
		llLlUserInfo = (LinearLayout) findViewById( R.id.llUserInfo );
		tvTvUserName = (TextView) findViewById( R.id.tvUserName );
		tvTvNickName = (TextView) findViewById( R.id.tvNickName );
		tvTvFamilyNum = (TextView) findViewById( R.id.tvFamilyNum );
		tvTitle = (TextView) findViewById( R.id.title );
		lvListView = (ListView) findViewById( R.id.listView );
		llLlBottom = (LinearLayout) findViewById( R.id.llBottom );
		ibBtnBack = (ImageButton) findViewById( R.id.btnBack );
		
		mAdapter = new MoreThemeAdapter(this, null);
		lvListView.setAdapter(mAdapter);
		
		tvTvUserName.setText(UserInfo.getInstance(this).getName());
		LoadAvatarBmpMgr.getInstance().loadBitmap(UserInfo.getInstance(this).getAvatarPath(),
				ivIvAvatar, null);
	}

	private void initEvent() {
		llLlTitle.setOnClickListener( this );
		ivIvAvatar.setOnClickListener( this );
		llLlUserInfo.setOnClickListener( this );
		tvTvUserName.setOnClickListener( this );
		tvTvNickName.setOnClickListener( this );
		tvTvFamilyNum.setOnClickListener( this );
		tvTitle.setOnClickListener( this );
		llLlBottom.setOnClickListener( this );
		ibBtnBack.setOnClickListener( this );

	}
	
	@Override
	public void onClick(View v) {
		if (v == ibBtnBack) {
			finish();
		}
	}
	
	
}
